﻿using System;
using System.Collections.Generic;
using System.Text;
using WorkFlowCore.IRepositories;

namespace WorkFlowCore.FormDesigns
{
    public class FormDesignVersion : WithBaseInfoEntity
    {
        public FormDesignVersion()
        {
        }

        public FormDesignVersion(Guid formDesignId, int version, string designContent, string designFramework)
        {
            FormDesignId = formDesignId;
            Version = version;
            DesignContent = designContent;
            DesignFramework = designFramework;
        }

        public FormDesignId GetFormDesignId()
        {
            return new FormDesignId(FormDesignId, Version);
        }

        public void Update(string designContent, string designFramework)
        {
            DesignContent = designContent;
            DesignFramework = designFramework;
        }

        internal void Delete()
        {
            Deleted= true;
            DeletedTime= DateTime.Now;
        }
        /// <summary>
        /// 表单设计id
        /// </summary>
        public Guid FormDesignId { get; set; }
        /// <summary>
        /// 版本
        /// </summary>
        public int Version { get; set; }
        /// <summary>
        /// 设计内容（通常为json字符串，以采用的表单设计框架为准）
        /// </summary>
        public string DesignContent { get; set; }
        /// <summary>
        /// 表单设计框架（用于标识前端采用的是什么表单编辑器，可能针对不同的编辑器定制渲染）
        /// </summary>
        public string DesignFramework { get; set; }
    }
}
